import type { RouteRecordRaw } from "vue-router";

const learningRouter: RouteRecordRaw[] = [
  {
    path: "/shallow",
    name: "Shallow",
    component: () => import("@/views/shallow/shallow-index.vue"),
  },
  {
    path: "/life",
    name: "Life",
    component: () => import("@/views/life/life-index.vue"),
  },
  {
    path: "/form",
    name: "Form",
    component: () => import("@/views/form/form-index.vue"),
  },
  {
    path: "/store",
    name: "Store",
    component: () => import("@/views/store/store-index.vue"),
  },
  {
    path: "/permission",
    name: "Permission",
    component: () => import("@/views/permission/permission-index.vue"),
    beforeEnter: (to, from, next) => {
      console.log("路由独享守卫 from", from);
      if (to.query.id === "666") {
        alert("路由独享守卫：我阻止了");
        next(false);
      } else {
        next();
      }
    },
  },
];

export default learningRouter;
